-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change celery pool support from prefork to threads #1437
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh yes, the old "multiprocessing vs threading" problem.
Which is truly solved with "async", but that's a heavy rewrite for a different decade.
this will, I believe, make the celery stuff become single-core. unless it has independent banaries outside of Python that are handling it, then it might just in general be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @terrazoon! Let's see if this works as we expect it to!
Description
The article referenced in issue #1432 says that prefork is the default pool support for Celery because it is robust and pythonic and good for CPU bound apps. The problem becomes when you have an IO bound app, and you find out that prefork is a CPU hog. Prefork holds onto CPU utilization even when nothing is going on. Our last load test showed that we seemed to exceed our allocated CPU utilization by a wide margin and this seemed to destabilize the app towards the end of the test.
By switching to threads, we will have more concurrency, less CPU utilization, and less memory utilization. ASSUMING IT IS STABLE. The caveats are that everything has to be thread safe. We are currently using multiprocessing.Manager (thread safe) and ThreadPoolExecutor (thread safe) so we might be good here.
Testing locally this of course works perfectly fine. We should do a load test on production after hours and see if this would be a viable approach.
Security Considerations